package arithmetic.Singleton;

import java.io.Serializable;

/**
 * Created by jiangfeng on 2017/10/15. 一个简单的懒汉单例 (内部类实现)
 */
public class Singleton2 implements Serializable {

    private static class Inner {
        static Singleton2 INSTACE = new Singleton2();
    }

    private Singleton2() {
        System.out.println(Thread.currentThread().getName() + " initial!");
    }

    public static Singleton2 getInstance() {
        return Inner.INSTACE;
    }

}
